package agenceVoyageVirtuel.client.control;

import agenceVoyageVirtuel.client.Agence_voyage_virtuel;

import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DecoratedStackPanel;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.DeckPanel;
import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.StackPanel;

public class MenuLateral extends Composite {
	private VerticalPanel leftMenuPanel;
	private final Agence_voyage_virtuel agence_voyage_virtuel;

	public MenuLateral(Agence_voyage_virtuel agence_voyage_virtuel) {
		
		this.agence_voyage_virtuel = agence_voyage_virtuel;
		
		leftMenuPanel = new VerticalPanel();
		initWidget(leftMenuPanel);
		
		final FocusPanel focus = new FocusPanel();
		leftMenuPanel.add(focus);
		
		final Tree tree = new Tree();
		focus.add(tree);
		tree.setSize("100%", "100%");
		
		final TreeItem trtmCatgorieDeVoyages = new TreeItem("Cat\u00E9gorie de Voyages");
		tree.addItem(trtmCatgorieDeVoyages);
		
		TreeItem trtmRel = new TreeItem("R\u00E9el");
		trtmCatgorieDeVoyages.addItem(trtmRel);
		
		TreeItem trtmFantastique = new TreeItem("Fantastique");
		trtmCatgorieDeVoyages.addItem(trtmFantastique);
		trtmCatgorieDeVoyages.setState(true);
		
		TreeItem trtmEspacePersonnel = new TreeItem("Espace Personnel");
		tree.addItem(trtmEspacePersonnel);
		
		TreeItem trtmInformationsPersonnelles = new TreeItem("Informations Personnelles");
		trtmEspacePersonnel.addItem(trtmInformationsPersonnelles);
		trtmInformationsPersonnelles.setText("Informations Personnelles");
		
		TreeItem trtmAvatars = new TreeItem("Avatars");
		trtmEspacePersonnel.addItem(trtmAvatars);
		trtmAvatars.setText("Avatars");
		
		TreeItem trtmFavoris = new TreeItem("Favoris");
		trtmAvatars.addItem(trtmFavoris);
		
		TreeItem trtmParcourir = new TreeItem("Parcourir");
		trtmAvatars.addItem(trtmParcourir);
		trtmAvatars.setState(true);
		trtmEspacePersonnel.setState(true);
		
		TreeItem trtmPanier = new TreeItem("Panier");
		tree.addItem(trtmPanier);
		
		TreeItem trtmPanierActuel = new TreeItem("Actuel");
		trtmPanier.addItem(trtmPanierActuel);
		trtmPanierActuel.setText("Actuel");
		
		TreeItem trtmAnciennesCommandes = new TreeItem("Anciennes Commandes");
		trtmPanier.addItem(trtmAnciennesCommandes);
		trtmPanier.setState(true);
		
		focus.addDoubleClickHandler(new DoubleClickHandler() {
			
			@Override
			public void onDoubleClick(DoubleClickEvent event) {
				if(tree.getSelectedItem()==trtmCatgorieDeVoyages)
					MenuLateral.this.agence_voyage_virtuel.selectDefaultView();
			}
		});
	}

	
}
